<script lang="ts" setup>
import { Layout } from 'ant-design-vue'
import { computed } from 'vue'

import LayoutContent from './content/index.vue'
import LayoutMultipleHeader from './header/MultipleHeader.vue'
import LayoutSideBar from './sider/index.vue'
import { useMenuSetting } from '@/hooks/setting/useMenuSetting'
import { useAppInject } from '@/hooks/web/useAppInject'
import { createAsyncComponent } from '@/utils/factory/createAsyncComponent'

defineOptions({ name: 'DefaultLayout' })

const LayoutFeatures = createAsyncComponent(() => import('@/layouts/default/feature/index.vue'))

const { getIsMobile } = useAppInject()
const { getShowSidebar } = useMenuSetting()

const layoutClass = computed(() => {
  return ['ant-layout', 'ant-layout-has-sider']
})
</script>

<template>
  <Layout class="min-h-full w-full flex flex-col">
    <LayoutFeatures />
    <Layout :class="[layoutClass]">
      <LayoutSideBar v-if="getShowSidebar || getIsMobile" />
      <Layout class="ml-0.25 w-full">
        <LayoutMultipleHeader />
        <LayoutContent />
      </Layout>
    </Layout>
  </Layout>
</template>
